POV-Ray : Newsgroups : povray.general : Array scope/persistance and vtransform : Array scope/persistance and vtransform Server Time
30 Jul 2024 12:21:55 EDT (-0400)
  Array scope/persistance and vtransform  
From: [GDS|Entropy]
Date: 1 Feb 2009 08:40:12
Message: <4985a63c$1@news.povray.org>
I am trying to fill an array with vectors from inside the loop which builds 
the vectors, to be used outside of that loop (by a macro which tests ray 
intersection, and if so draws a glow).
So far I have been completely unsuccessful, having tried setting the array 
up two different ways each producing a different error stating that the one 
thing or another is uninitialized.

I have read the FM regarding arrays, but still fail to see their usefulness 
if the data they contain isn't portable outside the scope of the loop which 
populates them.
I just want a List<T> right about now...

What I am trying to do is this (pseudo code to save space):

declare array

macro
loop
 fill array
endloop
endmacro

use array

If I had my List<T> I could just do:

List<vector> myList = new List<vector>();
while (n < 6)
{
 myList.Add(<Math.Sin(n),n,Math.Cos(n)>)
 n++;
}

foreach(vector v in myList)
{
 testRay(v,cam_pt,myObject)
}

Is there a way to do this in povray?

My second question: I have an object constructed thusly-I translate an 
object(a) into an "object(b) of objects(a)" in one loop, then translate that 
"object(b)" into an "object(c) of objects(b)". Is there a way using an array 
as specified above, to determine the end position in object(c) of each 
object(a) using vtransform (or something)? Am I close?

I've used pov for years, but never consistantly enough to know how to do 
either of these two things in SDL.

I am half considering just writing a freaking C# program to dump my vectors 
into a file, which I could import into povray...but thats a really ugly 
solution.

I would really appreciate any help with this, as these two problems have 
plagued me for years in various incarnations across many WIP, including my 
most recent. >_<'

thanks,
ian


Post a reply to this message

Copyright 2003-2023 Persistence of Vision Raytracer Pty. Ltd.